#!/usr/bin/perl

use strict;

my $block = shift ARGV;
die unless int $block;

while (<>) {
	my $yes = 0;
	for my $x (/(\d+\~\d+)/) {
		my ($s,$l) = split(/\~/,$x);
		$yes = 1 if ($block >= $s && $block < $s+$l);
	}	
	print if $yes;
}
